import request from './axiosConfig'

// 酒店相关接口

// 获取所有酒店
export const getAllHotels = () => {
  return request({
    url: '/hotels',
    method: 'get'
  })
}

// 获取酒店详情
export const getHotelById = (id: number) => {
  return request({
    url: `/hotels/${id}`,
    method: 'get'
  })
}

// 创建酒店
export const createHotel = (data: {
  name: string
  address: string
  starRating: number
}) => {
  return request({
    url: '/hotels',
    method: 'post',
    data
  })
}

// 更新酒店
export const updateHotel = (id: number, data: {
  name?: string
  address?: string
  starRating?: number
}) => {
  return request({
    url: `/hotels/${id}`,
    method: 'put',
    data
  })
}

// 删除酒店
export const deleteHotel = (id: number) => {
  return request({
    url: `/hotels/${id}`,
    method: 'delete'
  })
}

// 获取酒店房间列表
export const getHotelRooms = (hotelId: number) => {
  return request({
    url: `/hotels/${hotelId}/rooms`,
    method: 'get'
  })
}

// 创建房间
export const createRoom = (data: {
  roomType: string
  price: number
  status: string
  hotelID: number
}) => {
  return request({
    url: '/rooms',
    method: 'post',
    data
  })
}

// 更新房间
export const updateRoom = (id: number, data: {
  roomType?: string
  price?: number
  status?: string
}) => {
  return request({
    url: `/rooms/${id}`,
    method: 'put',
    data
  })
}

// 删除房间
export const deleteRoom = (id: number) => {
  return request({
    url: `/rooms/${id}`,
    method: 'delete'
  })
} 